<template>
  <div class="box">
    儿子2的文具： {{ toy }}<br>
    <button class="btn" @click="handlePrice(300)">修改父亲汽车的价格</button>
    <button class="btn" @click="sendBorther">赠送一个跑步机给哥哥</button>
  </div>

</template>

<script lang='ts' setup>
import { ref } from 'vue';
import emitter from '@utils/emitter';

const toy = ref("跑丁车")
const handlePrice = (price: number) => {
  emitter.emit('change-price', price);
}

const sendBorther = () => {
  emitter.emit("change-toy", "跑步机")
}

</script>

<style scoped lang='scss'>
.box {
  border: 1px solid #ccc;
  padding: 10px;
  background-color: rgb(46, 180, 86);
  color: white;
  margin-top: 20px;
  min-height: 120px;
}
</style>
